#include"Client.h"
#include<QByteArray>

Client::Client(QObject *parent)
      :QTcpSocket(parent){

    connect(this,SIGNAL(readyRead()),this,SLOT(dataReceive()));
    connect(this,SIGNAL(disconnected()),this,SLOT(slotdisconnect()));
}

Client::~Client(){
}

void Client::dataReceive(){
     QByteArray data;
     data.resize(bytesAvailable());
     data = readAll();
     emit updateServer(QString(data.data()));
}

void Client::slotdisconnect(){
    emit disconnect(socketDescriptor());
}
